import { HOME_URL, LOGIN_URL } from "@/config";
import type { RouteRecordRaw } from "vue-router";

/**
 * @description 静态路由
 */
export const staticRouter: RouteRecordRaw[] = [
  {
    path: "/",
    redirect: "/layout"
  },
  {
    path: LOGIN_URL,
    name: "login",
    component: () => import("@/views/login/index.vue"),
    meta: { title: "登录" }
  },
  {
    path: "/layout",
    name: "layout",
    redirect: "dashboard",
    component: () => import("@/layouts/index.vue"),
    children: [
      {
        path: HOME_URL,
        name: "Dashboard",
        component: () => import("@/views/dashboard/index.vue"),
        meta: {
          title: "首页",
          icon: "House",
          isHidden: false,
          isKeepAlive: true,
          isAffix: true,
          activeMenu: true
        }
      },
      {
        path: "/system/user-auth" + "/role/:id",
        name: "systemUserAuth",
        component: () => import("@/views/system/user/autoRole.vue"),
        meta: {
          title: "分配角色",
          isHidden: true,
          isKeepAlive: false,
          isAffix: false,
          activeMenu: false,
          permissions: "system:user:edit"
        }
      },
      {
        path: "/system/role-assigning-users",
        name: "systemRoleAssigningUsers",
        component: () => import("@/views/system/role/AssigningUsers.vue"),
        meta: {
          title: "分配权限",
          isHidden: true,
          isKeepAlive: false,
          isAffix: false,
          activeMenu: false,
          permissions: "system:role:edit"
        }
      },
      {
        path: "/system/role-perssionRole",
        name: "systemRolePerssionRole",
        component: () => import("@/views/system/role/perssionRole.vue"),
        meta: {
          title: "分配权限",
          isHidden: true,
          isKeepAlive: false,
          isAffix: false,
          activeMenu: false,
          permissions: "system:role:edit"
        }
      },
      {
        path: "/system/dict-data" + "/index/:dictId",
        name: "systemDictDataIndex",
        component: () => import("@/views/system/dict/data.vue"),
        meta: {
          title: "字典数据",
          isHidden: true,
          isKeepAlive: false,
          isAffix: false,
          activeMenu: false,
          permissions: "system:dict:list"
        }
      },
      {
        path: "/userCentre",
        name: "userCentre",
        component: () => import("@/views/userCentre/index.vue"),
        meta: {
          title: "个人中心",
          icon: "Edit",
          isHidden: true,
          isKeepAlive: true,
          isAffix: false,
          activeMenu: false
        }
      }
      // {
      //   path: "/salesOutboundOrder",
      //   name: "SalesOutboundOrder",
      //   component: () => import("@/views/salesOutboundOrder/index.vue"),
      //   meta: {
      //     title: "销售出库单",
      //     icon: "user-outlined",
      //     isHidden: true,
      //     isKeepAlive: true,
      //     isAffix: false,
      //     activeMenu: false
      //   }
      // },
      // {
      //   path: "/receipt/add",
      //   name: "ReceiptDetailsInfo",
      //   component: () => import("@/views/receipt/ReceiptDetailsInfo.vue"),
      //   meta: {
      //     title: "新增单据",
      //     icon: "user-outlined",
      //     isHidden: true,
      //     isKeepAlive: true,
      //     isAffix: false,
      //     activeMenu: false
      //   }
      // },
    ]
  }
];

/**
 * @description 错误页面路由
 */
export const errorRouter: RouteRecordRaw[] = [
  {
    path: "/403",
    name: "403",
    component: () => import("@/components/Exception/403.vue"),
    meta: {
      title: "403页面"
    }
  },
  {
    path: "/404",
    name: "404",
    component: () => import("@/components/Exception/404.vue"),
    meta: {
      title: "404页面"
    }
  },
  {
    path: "/500",
    name: "500",
    component: () => import("@/components/Exception/500.vue"),
    meta: {
      title: "500页面"
    }
  },
  {
    path: "/:pathMatch(.*)*",
    component: () => import("@/components/Exception/404.vue")
  }
];
